package gameUi.panel
{
	import flash.events.MouseEvent;

	public class BuyChipSurePanel extends BuyChipPanelMC
	{
		private static var instance:BuyChipSurePanel;
		
		private var _chipNum:int;//兑换筹码数
		
		public function BuyChipSurePanel(key:Key)
		{
			cmdYes.addEventListener(MouseEvent.CLICK,clickYes);
			cmdNo.addEventListener(MouseEvent.CLICK,clickNo);
			bg.addEventListener(MouseEvent.MOUSE_DOWN,onBeginDrag);
			BlackJack._stage.addEventListener(MouseEvent.MOUSE_UP,onStopDrag);
		}
		
		public static function getInstance():BuyChipSurePanel{
			if(!instance) instance = new BuyChipSurePanel(new Key());
			return instance;
		}
		
		private function clickYes(e:MouseEvent):void{
			BlackJack.chipSocketSender.chipOverPack(_chipNum);
			clickNo();
		}
		
		private function clickNo(e:MouseEvent = null):void{
			if(this.parent) this.parent.removeChild(this);
		}
		
		private function onBeginDrag(e:MouseEvent):void{
			this.startDrag();
		}
		
		private function onStopDrag(e:MouseEvent):void{
			this.stopDrag();
		}
		
		public function showInfo(num:int):void{
			_chipNum = num;
			panelTxt.text = "您将使用账户的积分余额购买"+ num + "（每1个积分=10块筹码）数额的游戏筹码。游戏筹码余额不可兑换现金或账户积分，只可用于商城购物冲抵现金。";
			this.x = BlackJack._stage.stageWidth/2;
			this.y = BlackJack._stage.stageHeight/2;
			BlackJack._stage.addChild(this);
		}
	}
}
class Key{}